@include("/common/_html_start.html", {title: "中文汉字内码互相转换"}){}
@include("/common/_header.html"){}
<style>


</style>

<section class="container">
    <div class="row">
        <div class="col-md-12">
            <h2>汉字内码互相转换</h2>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
            <textarea id="chars" rows="8" class="form-control" placeholder="unicode转汉字格式：\u4E00\u208A3\u74DC&#10;汉字转unicode格式：一𠢣瓜" style="resize:none" ></textarea>
        </div>
        <div class="col-md-6">
            <textarea id="chars2" rows="8" class="form-control" style="resize:none"  readonly></textarea>
        </div>
    </div>
    <div class="row info-row">
        <div class="col-md-12">
            <div id="info" class="alert alert-info"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <button class="btn btn-info changeBtn" data-type="toUnicode">汉字转unicode</button>
            <button class="btn btn-info changeBtn" data-type="toChars">unicode转汉字</button>
        </div>
    </div>

    <div class="row">
        <div class="col-md-12">

            <!-- 垂直广告 -->
            <ins class="adsbygoogle"
                 style="display:block"
                 data-ad-client="ca-pub-7709929597192577"
                 data-ad-slot="2349169544"
                 data-ad-format="auto"
                 data-full-width-responsive="true"></ins>
            <script>
                (adsbygoogle = window.adsbygoogle || []).push({});
            </script>
        </div>
    </div>
</section>


@include("/common/_bottom.html"){}
@include("/common/_footer.html"){}
@include("/common/_html_common_js.html"){}
<script>
    $(function() {
        $(".info-row").hide();
        $(".changeBtn").click(function() {
            var c = $("#chars").val();
            if(c.length>0){
                var t = $(this).data("type");
                $.post("/toChange", {type:t, para:c}, function(data) {
                    $("#chars2").val(data.data);
                    if(data.message){
                        $("#info").html("共 "+data.message+" 个字符");
                        $(".info-row").show();
                    }
                });
            }
        })
    })
</script>
@include("/common/_html_end.html"){}

